package com.zy.composeworld

import android.os.Bundle
import android.util.Log
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.zy.composeworld.demo.demo1.MainFrame
import com.zy.composeworld.ui.screens.list.LazyListExample002
import com.zy.composeworld.ui.screens.navigation.NavigationTestPager001
import com.zy.composeworld.ui.theme.ComposeWorldTheme
import com.zy.composeworld.utils.TAG

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            ComposeWorldTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colorScheme.background
                ) {
                    //Greeting("Android")
                    //MainList()
                    //MainFrame()
                    //ScaffoldPagers001()
                    //CenterAlignedTopAppBarExample()
                    //MediumTopAppBarExample()
                    //LargeTopAppBarExample()

                    //BottomAppBarExample()

                    //ButtonExample()

                    //CardExample()
                    //ChipExample()

                    //DialogExample()
                    //ProgressExample()
                    //SliderExample()
                    //SwitchExample()

                    //BottomSheetExample()

                    //DrawerExample()
                    //DrawerExample002()

                    //SnackBarExample()
                    //SnackBarExample002()

                    //LazyListExample()
                    //LazyListExample001()
                    //LazyListExample002()

                    //ResourceExample()

                    //LayoutMainPager()

                    //TextMainPager()

                    //ImageMainPager()


                    //Demo1
                    MainFrame()

                    //NavigationTestPager001()
                }
            }
        }
    }

    override fun onResume() {
        super.onResume()
    }
}

@Composable
fun MainList() {
    Column(modifier = Modifier.padding(16.dp)) {
        Text(
            text = "界面架构",
        )
        Text(
            text = "开发应用的布局",
        )
        Text(
            text = "组件",
        )
        Text(
            text = "主题",
        )
        Text(
            text = "文本和排版",
        )
        Text(
            text = "图片和图形",
        )
        Text(
            text = "动画",
        )
        Text(
            text = "无障碍功能",
        )
        Text(
            text = "轻触和输入",
        )
        Text(
            text = "性能",
        )
        Text(
            text = "样式指南",
        )
        Text(
            text = "界面测试",
        )
        Text(
            text = "迁移到Compose",
        )
        Text(
            text = "工具",
        )
        Text(
            text = "利用系统功能",
        )
        Text(
            text = "创建Widget",
        )
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Button(
        onClick = {
            Log.d(TAG, "this")

        }
    ) {
        Text(
            text = "Hello $name!",
            modifier = modifier
        )
    }
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    ComposeWorldTheme {
        Greeting("Android")
    }
}